package com.sunyard.dal.mapper;

import com.sunyard.dal.dto.DeviceTaskDTO;
import com.sunyard.dal.dto.TaskDTO;
import com.sunyard.dal.dto.TaskDetailDTO;
import com.sunyard.dal.dto.TaskTypeDTO;
import com.sunyard.dal.entity.Task;
import com.sunyard.dal.entity.TaskCopy;
import com.sunyard.dal.entity.TaskKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface TaskMapper {
    int deleteByPrimaryKey(TaskKey key);



    int insert(Task record);

    int insertSelective(TaskCopy record);

    Task selectByPrimaryKey(TaskKey key);

    int updateByPrimaryKeySelective(Task record);

    int updateByPrimaryKey(Task record);

    List<TaskDTO> queryByPage(Task task);

    List<Task> listTask(String deviceSn);

    int selectTaskByDevSN(TaskCopy taskCopy);

    List<Task> selectLastTask(TaskCopy taskCopy);

    List<Task> selectTaskById(String taskId);

    int isNotStart(String taskId);

    int isOnGonging(String taskId);

    /**
     * @Description: 判断该终端下有无进行中的终端任务
     * @Author: huix.Liang
     * @Date: 2019-07-26 11:26
     */
    int isOnGongingByDeviceSn(String deviceSn);

    void updateByList(@Param("list") List<Task> taskList);

    /**
     * @Description: 根据机构码获取任务list
     * @Author: jiy.fang
     * @Date: 2019/7/24 15:20
     */
    List<Task> getListTaskByOrgId(String orgId);

    int checkTaskStatusByAppId(String appId);

    /**
     * @Description: 条件分页查询终端任务
     * @Author: huix.Liang
     * @Date: 2019-07-26 09:22
     */
    List<DeviceTaskDTO> getListDeviceTask(Task task);

    /**
     * @Description: 根据应用编号和终端号查询任务
     * @Author: ziliang.zhou
     * @Date: 2019-07-26 09:22
     */
    List<Task> selectTask(TaskCopy taskCopy);

    /**
     * @Description: 更新任务状态
     * @Author: ziliang.zhou
     * @Date: 2019-07-26 09:22
     */
    int update(Task task);

    /**
     * @Description: 根据appid和终端硬件序列号查询任务
     * @Author: ziliang.zhou
     * @Date: 2019-07-26 09:22
     */
    List<Task> selectTaskByAppIDAndDevSn(Task task);

    /**
     * @Description: 查询单个终端任务详情
     * @Author: huix.Liang
     * @Date: 2019-08-01 11:32
     */
    DeviceTaskDTO getTaskDetail(@Param("taskId") String taskId, @Param("deviceSn") String deviceSn);

    /**
     * @Description: 根据文件编号查询任务
     * @Author: ziliang.zhou
     * @Date: 2019-08-01 11:32
     */
    List<Task> selectTaskByDocId(String documentId);

    /**
     * @Description: 展示任务详情对比
     * @Author: ziliang.zhou
     * @Date: 2019-09-26 10:42
     */
    TaskDetailDTO showRecordChange(@Param("taskId") String taskId, @Param("deviceSn") String deviceSn);

    //获取首页待审核任务数量
    int getTaskAuditCount(@Param("orgIds") List<String> orgIds);

    //任务种类统计
    List<TaskTypeDTO> getTaskTypes(@Param("orgIds") List<String> orgIds);

    //任务期限统计
    int getTaskTime(@Param("orgIds") List<String> orgIds);

    //任务期限统计-获取即将过期任务
    int getBeOverdueTask(@Param("orgIds") List<String> orgIds);

    //获取机构下任务数量
    int getTaskCountByOrgId(@Param("orgIds") List<String> orgIds);

    /**
     * 获取开锁人列表
     *
     * @return List<String>
     * @author: guangw.dang
     * @Date: 2022/8/18 9:22
     **/
    List<String> getOpenLockOp();

    List<String> getOpenLockSn();



    /**
     * @Description: 查询单个终端任务详情
     * @Author: huix.Liang
     * @Date: 2019-07-26 10:42
     */
//    DeviceTaskReturnDTO getSingleDeviceTask(TaskKey taskKey);
}